hysop.parameters.tensor_parameter module¶
- class hysop.parameters.tensor_parameter.TensorParameter(name, shape, dtype=<class 'numpy.float64'>, pretty_name=None, initial_value=None, min_value=None, max_value=None, ignore_nans=False, **kwds)[source]¶
Bases:
Parameter
A tensor parameter is np.ndarray of a given dtype and shape that may change value as simulation advances.
Initialize a TaggedObject with a tag prefix/postfix/formatter, all optional.
- static __new__(cls, name, shape, dtype=<class 'numpy.float64'>, pretty_name=None, initial_value=None, min_value=None, max_value=None, ignore_nans=False, **kwds)[source]¶
Create or get an existing TensorParameter with a specific name shape and dtype.
- Parameters:
name (string) – A name for the parameter that uniquely identifies it.
pretty_name (string) – A pretty name for the parameter.
shape (array like of ints) – Shape of this TensorParameter.
dtype (type convertible to np.dtype, optional) – Underlying dtype of this TensorParameter. Defaults to HYSOP_REAL.
initial_value (optional, defaults to an uninitialized array.) – Initial value as a scalar or np.ndarray. If not initial value is given, all values initialized to 0.
min_value (scalar, optional, defaults to None) – Minimum value allowed for this parameter.
max_value (scalar, optional, defaults to None) – Maximum value allowed for this parameter.
ignore_nans (bool) – Set this to True to allow NaN values.
kwds (dict) – Base class arguments.
- shape¶
Shape of this TensorParameter.
- Type:
array like of ints
- dtype¶
Underlying dtype of this TensorParameter.
- Type:
type convertible to np.dtype
- min_value¶
Minimum value allowed for this TensorParameter.
- Type:
scalar, optional, defaults to None
- max_value¶
Maximum value allowed for this TensorParameter.
- Type:
scalar, optional, defaults to None
- __setitem__(slices, value)[source]¶
Set a subview on this array parameter to a certain value (value can be broadcasted).
- property ctype¶
Get the data type of the discrete field as a C type.
- property dtype¶
Get parameter dtype.
- property ignore_nans¶
Return True if array can have NaNs.
- property max_value¶
Return maximum value allowed for array values.
- property min_value¶
Return minimum value allowed for array values.
- property shape¶
Get parameter shape.
- property size¶
Get parameter size.
- property tensor_value¶
Get a read-only view on this array parameter but always as a numpy array, even for ScalarParameter parameters.